﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class masAdmin : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            LoadCurrentLeftMenu();
    }

    private void LoadCurrentLeftMenu()
    {
        string strPageName = Request.Path.ToString().Substring(Request.Path.ToString().LastIndexOf("/") + 1);
        string strSub = string.Empty;
        strPageName = strPageName.Replace(".aspx", "").ToLower();

        HtmlAnchor control = (HtmlAnchor)this.FindControl("a" + strPageName);
        if (control != null)
        {
            control.Attributes.Add("class", "current");
            strSub = control.Title;
        }

        HtmlAnchor menu = (HtmlAnchor)this.FindControl("as" + strSub);
        if (menu != null)
        {
            menu.Attributes.Add("class", "nav-top-item current");
        }
    }
    protected void LoginStatus1_LoggedOut(object sender, EventArgs e)
    {
        Response.Redirect("default.aspx");
    }
}
